
var data=[];
function alltypepageing(url,name,value) {

	var adata = {
        name : name,
        pagesize : 999,
        pagenumber : 1,
        value:value
	};
	// 列表功能
	$.ajax({
		type : "GET",
		data : adata,
		dataType : "json",
		url : url,
		success : function(json) {
			// 数据
			data = json;
            $("#content").html(thisDate());
		}
	});

}




//分页   要求后台传出固定格式的数据  调用 page.js 方法
// alltypepageing("/Auth/check/Select.shtml","age","44");
function thisDate() {
	var str = '';

	for (var i = 0; i < data.length; i++) {

        str += "<tr>"+
            "<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+data[i].age+"</td>"+
			"<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+data[i].sex+"</td>"+
			"<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+data[i].nxgbhistory+"</td>"+
			"<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+data[i].bloodSugar+"</td>"+
			"<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+data[i].bloodSugar2h+"</td>"+
			"<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+data[i].triglyceride+"</td>"+
            "<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+data[i].smoke+"</td>"+
            "<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+data[i].drink+"</td>"+
            "<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+data[i].bmi+"</td>"+
            "<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+data[i].phone+"</td>"+
            "<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+data[i].updateTime+"</td>"+
            "<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+data[i].other+"</td>"+
			"<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+data[i].datafrom+"</td>"+
			"<td class='am-hide-sm-only' style='background-color: rgba(0,0,0,0);text-align:center;'>"+
			"<a class='am-btn am-btn-primary am-btn-xs' style='border: 1px solid #c5b9b9f5;'  onclick=\"updateuserinfo('"+data[i].id+"');\">"+
			"		修改"+
			"</a>"+
			"	<a class='am-btn am-btn-danger am-btn-xs' style='border: 1px solid #c5b9b9f5;'  onclick=\"deleteInfo('"+data[i].id+"');\"> 删除"+
			"	</a> "+
			"	</td>"+
			"</tr>";
	}
	return str;

}


function deleteInfo(a) {
	var Confirm = confirm("你确定要删除该条信息吗？");
	if (Confirm == true) {
		$.ajax({
			type: "Delete",
			contentType: "application/json",
			dataType: "json",
			url: "/Auth/check/delete" + a,
			success: function (data) {
				if (data == 1) {
					alert("删除成功！");
					alltypepageing("/Auth/check/Select.shtml", null);
				}

			}
		});
	}
}
//编辑信息
function updateuserinfo(b) {
	sessionStorage.setItem("id",b)
	window.location.href = "/Auth/form.html";

}




